package main

import "fmt"

type person struct {
	name string
	age  int
}

func (p *person) birth() {
	p.age++
}

// 参数不为指针 无法修改原始值
func (p person) birth2() {
	p.age++
}

func fun(a []string) {
	a[0] = "wk"
}

func main() {
	may := person{
		name: "may",
		age:  15,
	}

	fmt.Println(may)

	// 点操作符自动使用&取得变量的内存地址
	// (&may).birth()
	may.birth()
	fmt.Println(may)
	may.birth2()
	fmt.Println(may)

	b := [3]string{"1", "2", "3"}
	a := b[1:2]
	fun(a)
	fmt.Println(b)
}
